<?php
session_start();
if(isset($_SESSION['admin_id'])) {
    include('../include/dbFunctions.php');
    $_SESSION['mes']="";
    $sponsor_id= $_SESSION['sponsor_id'];
//Retrieve data from AJAX data sent by jEditable
$updateID = $_SESSION['id'];
    $sponsor_name = htmlspecialchars($_POST['sponsor_name'],ENT_QUOTES);
    $sponsor_description = htmlspecialchars($_POST['sponsor_description'],ENT_QUOTES);

    $query1 = "UPDATE sponsor
            SET sponsor_name = '".$sponsor_name."',
                sponsor_description = '".$sponsor_description."'
            WHERE sponsor_id='".$sponsor_id."'";

$result1 = executeQuery($query1);
   if ($result1!=0) {
        $_SESSION['mes'] = "Your record has been added successfully.";
    } else {
        $_SESSION['mes'] = "Error! Please try again";
    }$link = "sponsorView.php?id=$sponsor_id";
    header("Location: $link ");

}else {
    header("Location: ../include/login.html");
}
?>
